package com.api.main.excel;

import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Row;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class VoteTitleHandler implements CellWriteHandler {

    private String title;

    private String describe;

    private Date voteTime;

    public VoteTitleHandler(String title, String describe, Date voteTime) {
        this.title = title;
        this.describe = describe;
        this.voteTime = voteTime;
    }

    @Override
    public void beforeCellCreate(WriteSheetHolder writeSheetHolder,
                                 WriteTableHolder writeTableHolder,
                                 Row row, Head head,
                                 Integer integer,
                                 Integer integer1,
                                 Boolean aBoolean) {
        if (head != null) {
            List<String> headNames = new ArrayList<>();
            headNames.set(1, "测试1");
            headNames.set(2, "测试2");
            headNames.set(3, "测试3");
            headNames.set(4, "测试4");
            headNames.set(5, "测试5");
            headNames.set(6, "测试6");
            head.setHeadNameList(headNames);
        }
    }
}